<?php
/**
 * Set configuration for controllers
 * NAME OF CONFIGURATION VARIABLES
 * 
 *[conf_autentication]
 *user.Public  = allwo
 *user.Public.Index = allwo
 *          
 *user2.Administrador = allow
 *user2.Administrador.Preco = allow
 *user2.Administrador.Preco.save = allow
 *
 * @package Nucleo
 * @subpackage Nucleo.Configuration
 * @author Renan Henrique Abreu <renanhabreu@gmail.com>
 * @copyright 2009-2010 Renan Abreu
 */	
abstract class Nucleo_Configuration_Authentication  implements Nucleo_Configuration{
	static private $configured = false;
	
	static public function setConfiguration($fileName){
			
		if(!self::$configured){
			if($configuration = parse_ini_file($fileName,TRUE)){
				
				$ACL_LIST = $configuration['conf_authentication'];
						
				if(isset($ACL_LIST)){	
					foreach($ACL_LIST as $role=>$permission)
						Nucleo_Controller_Authentication::addRole($user,explode('.',$role),$permission);																		
				}else
					throw new Nucleo_Exception_Sifra('017',true);
				
				self::$configured = true;		
			}else{
				throw new Nucleo_Exception_Load('003');
			}
		}
	}
	
}
?>